#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;

void main()
{
    long long n, q, a, b, i;
    cin >> n >> q;
    vector<long long> v(n, 0);
    vector<long long> dp(n + 1, 0);

    for (i = 0; i < n; i++)
    {
        cin >> v[i];
        if (i > 0)
            dp[i] = dp[i - 1] + v[i - 1];
    }
    dp[i] = dp[i - 1] + v[i - 1];

    while (q--)
    {
        cin >> a >> b;
        long long left = 0, right = n, mid = 0;
        long long ret = dp[a - 1] + b;
        while (left < right)
        {
            long long mid = (left + right) / 2;
            if (dp[mid] < ret)
                left = mid + 1;
            else
                right = mid;
        }
        if (dp[left] < ret)
            cout << -1 << endl;
        else
            cout << left - 1 << endl;

    }

}